//
//  QXZuTuanQiXingViewController.m
//  qiJi
//
//  Created by 凤利史 on 2018/4/18.
//  Copyright © 2018年 sunrose. All rights reserved.
//

#import "QXZuTuanQiXingViewController.h"
#import "CodeView.h"
#import "QXZuTuanTwoViewController.h"
@interface QXZuTuanQiXingViewController ()

@end

@implementation QXZuTuanQiXingViewController
- (void)viewWillAppear:(BOOL)animated{
    [super viewWillAppear:animated];
    
    
    [self.navigationController setNavigationBarHidden:NO animated:NO];
    
    
}
- (void)viewDidLoad {
    [super viewDidLoad];
    [self addView];
    UIView *threadView = [[UIView alloc]initWithFrame:CGRectMake(0, 1, DEF_SCREEN_WIDTH, 1)];
    threadView.backgroundColor = getColor(@"E6E6E6");
    [self.view addSubview:threadView];
    // Do any additional setup after loading the view.
}
- (void)addView {
    self.title = @"组团骑行";
    //右边item
    UIButton *searchBtn = [[UIButton alloc]initWithFrame:CGRectMake(0, 0, screenScale(40), screenScale(36))];
    [searchBtn setImage:[UIImage imageNamed:@"team_nav_btn"] forState:UIControlStateNormal];
    [searchBtn addTarget:self action:@selector(pianoBtnClick) forControlEvents:UIControlEventTouchUpInside];
    
    UIBarButtonItem *rightItme = [[UIBarButtonItem alloc]initWithCustomView:searchBtn];
    self.navigationItem.rightBarButtonItem = rightItme;
    //    NSArray *arr = @[@"普通，下划线 分割线",
    //                     @"普通，下划线",
    //                     @"密码",
    //                     @"密码，分割线"];
    //    NSArray *arr = @[@"普通，下划线"];
    
//    for (NSInteger i = 0; i < 1; i ++) {
        //        UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(0, 40 + 80 * i, self.view.frame.size.width, 20)];
        //        label.textAlignment = NSTextAlignmentCenter;
        //        label.text = arr[i];
        //        [self.view addSubview:label];
        
        CodeView *v = [[CodeView alloc] initWithFrame:CGRectMake(61, 150, self.view.frame.size.width - 122, 60)
                                                  num:4
                                            lineColor:getColor(@"D9D9D9")
                                             textFont:30];
        
        //下划线
        
        //v.hasUnderLine = YES;
        
        //分割线
        
        v.hasSpaceLine = NO;
        
        //输入之后置空
        
        v.emptyEditEnd = YES;
        
        v.underLineAnimation = YES;
        
        //输入风格
        
        v.codeType = CodeViewTypeCustom;
        
        //        switch (i) {
        //            case 0:
        //            {
        ////                //下划线
        ////                v.hasUnderLine = YES;
        //                //分割线
        //                v.hasSpaceLine = YES;
        //                //输入之后置空
        //                v.emptyEditEnd = YES;
        //                v.underLineAnimation = YES;
        //                //输入风格
        //                v.codeType = CodeViewTypeCustom;
        //            }
        //                break;
        //            case 1:
        //            {
        //                //下划线
        //                v.hasUnderLine = YES;
        //                //分割线
        //                v.hasSpaceLine = NO;
        //
        //                //输入风格
        //                v.codeType = CodeViewTypeCustom;
        //            }
        //                break;
        //            case 2:
        //            {
        //                //下划线
        //                v.hasUnderLine = NO;
        //                //分割线
        //                v.hasSpaceLine = NO;
        //
        //                //输入风格
        //                v.codeType = CodeViewTypeSecret;
        //            }
        //                break;
        //            case 3:
        //            {
        //                //下划线
        //                v.hasUnderLine = NO;
        //                //分割线
        //                v.hasSpaceLine = YES;
        //
        //                //输入风格
        //                v.codeType = CodeViewTypeSecret;
        //            }
        //                break;
        //            default:
        //                break;
        //        }
        
        
        v.EndEditBlcok = ^(NSString *str) {
            
            [self aaaa:str];
            
            
        };
        [self.view addSubview:v];
    UILabel *labelTit = [[UILabel alloc] init];
    [self.view addSubview:labelTit];
    [labelTit mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(v.mas_bottom).with.offset(35);
        make.left.equalTo(self.view).with.offset(61);
        make.right.equalTo(self.view).with.offset(-25);
        
    }];
    labelTit.text = @"与骑友输入相同的四个数字，即可组队";
    labelTit.font = [UIFont systemFontOfSize:15];
    labelTit.textColor = getColor(@"666666");
//    }
}

- (void)aaaa:(NSString *)strIng{
    
    if ([strIng isEqualToString:@"5555"]) {
        NSLog(@"wwwwwwwwww%@",strIng);
        QXZuTuanTwoViewController *vc = [[QXZuTuanTwoViewController alloc] init];
        [self.navigationController pushViewController:vc animated:YES];
        
    }else{
        
//        UIAlertController *alert = [UIAlertController alertControllerWithTitle:nil message:@"输入错误请重新输入" preferredStyle:(UIAlertControllerStyleAlert)];
        
//        UIAlertAction *action = [UIAlertAction actionWithTitle:@"确定" style:(UIAlertActionStyleDefault) handler:^(UIAlertAction *action) {
//        }];
//
//        UIAlertAction *cancel = [UIAlertAction actionWithTitle:@"取消" style:(UIAlertActionStyleCancel) handler:nil];
//        [alert addAction:action];
//        [alert addAction:cancel];
//        [self showDetailViewController:alert sender:nil];
        
        
       //  [PublicFunction showAlert:nil message:@"输入错误请重新输入" duration:5.0f];
        
    }
    
    
    
}
- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event {
    [self.view endEditing:YES];
}

- (void)pianoBtnClick{
    
    
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
